#ifndef __UART_UTILS_H
#define __UART_UTILS_H


#include "main.h"

#include "FreeRTOS.h"
#include "semphr.h"
#include "queue.h"


#define STM32F407_UART	1


struct uart_device{
	char *name;
	char (*init)(struct uart_device *dev, int baud, int data_bits, int stop_bits, int parity);
	char (*send)(struct uart_device *dev, unsigned char *data, unsigned int len, unsigned int timeout);
	char (*recv)(struct uart_device *dev, unsigned char *data, unsigned int timeout);
	void *priv;
};

struct priv_struct{
	UART_HandleTypeDef *xUart;
	SemaphoreHandle_t xMutex;
	QueueHandle_t xQueue;
	uint8_t pdata;
};

struct uart_device * find_dev_by_name(char *name);


#endif
